package com.hhkj.admin.student.service.base;

import com.hhkj.admin.student.domain.StudentBatch;
import com.hhkj.admin.student.model.dopo.StudentBatchDo;
import com.hhkj.admin.student.model.dopo.StudentBatchPo;
import com.hhkj.admin.student.model.dopo.StudentPo;
import com.hhkj.admin.student.model.req.StudentBatchReq;
import com.ruoyi.common.base.biz.service.base.BaseService;
import com.ruoyi.common.utils.num.NumUtils;

import java.util.List;

/**
 * 学员批次管理Service接口
 *
 * @author ruoyi
 * @since 2023-05-12
 */
public interface StudentBatchService extends BaseService<StudentBatch, StudentBatchDo, StudentBatchPo> {

    @Override
    default boolean save(StudentBatch entity) {
        Long count = this.countByToday();
        entity.setBatchNum(NumUtils.generateNum(++count));
        return BaseService.super.save(entity);
    }

    /**
     * 查询学员批次管理列表
     *
     * @param studentBatchReq 学员批次管理
     * @return 学员批次管理集合
     */
    List<StudentBatchPo> selectStudentBatchListByDo(StudentBatchReq studentBatchReq);

    /**
     * 查询批次下学员列表
     *
     * @param studentBatchReq 批次号id
     * @return 学员
     */
    List<StudentPo> listBatchStudentPoByDo(StudentBatchReq studentBatchReq);

    Long countByToday();
}
